<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>全部回复</title>
		<meta name="description" content="">
		<meta name="keywords" content="">
		<meta name="renderer" content="webkit">
		<!-- 设置缩放 -->
		<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, minimal-ui" />
		<!-- 可隐藏地址栏，仅针对IOS的Safari（注：IOS7.0版本以后，safari上已看不到效果） -->
		<meta name="apple-mobile-web-app-capable" content="yes" />
		<!-- 仅针对IOS的Safari顶端状态条的样式（可选default/black/black-translucent ） -->
		<meta name="apple-mobile-web-app-status-bar-style" content="black" />
		<!-- IOS中禁用将数字识别为电话号码/忽略Android平台中对邮箱地址的识别 -->
		<meta name="format-detection" content="telephone=no, email=no" />
		<!-- 启用360浏览器的极速模式(webkit) -->
		<meta name="renderer" content="webkit">
		<!-- 避免IE使用兼容模式 -->
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<!-- 针对手持设备优化，主要是针对一些老的不识别viewport的浏览器，比如黑莓 -->
		<meta name="HandheldFriendly" content="true">
		<!-- 微软的老式浏览器 -->
		<meta name="MobileOptimized" content="320">
		<!-- uc强制竖屏 -->
		<meta name="screen-orientation" content="portrait">
		<!-- QQ强制竖屏 -->
		<meta name="x5-orientation" content="portrait">
		<!-- UC强制全屏 -->
		<meta name="full-screen" content="yes">
		<!-- QQ强制全屏 -->
		<meta name="x5-fullscreen" content="true">
		<!-- UC应用模式 -->
		<meta name="browsermode" content="application">
		<!-- QQ应用模式 -->
		<meta name="x5-page-mode" content="app">
		<!-- windows phone 点击无高光 -->
		<meta name="msapplication-tap-highlight" content="no">
		<meta http-equiv="Cache-Control" content="no-siteapp" />
		<link rel="icon" type="image/png" href="../assets/i/favicon.png">
		<link rel="stylesheet" href="../assets/css/amazeui.css" />
		<link rel="stylesheet" href="../css/comm.css" />
		<link rel="stylesheet" href="../assets/css/beans.css" />
		<style>
			.am-icon-md:before {
			    font-size: 100%;
			    vertical-align: 0%;
			}
		</style>
	</head>
	<body>
		<header data-am-widget="header" class="am-header am-header-default bg-48CFAE">
			<div class="am-header-left am-header-nav text-black padding-left05" id="goBackDivs">
				<a  href="javascript:history.go(-1)" class="text-black" id="goBackIcon">
				  	<i class="am-align-left am-margin-0 am-icon-angle-left am-icon-md text-black co-fff"></i>
				  </a> 
			</div>
			<h1 class="am-header-title teblack">
				<a href="#title-link" class="co-fff title">全部回复</a>
			</h1>
		</header>
	  <div class="content">
	  		<div class="pinlun-tab content-tab">
				<!--<div class="problem-talk-tab">
				  	<div class="person-tab-head">
				  		<div class="head-image"><img src="./../img/person-head-img.png" alt=""></div>
						<div class="person-name">
							<p class="person-name-text">
								<span>芙蓉</span>
								<span><img src="" alt=""></span>
							</p>
							<p class="person-reply-time">2018-7-20  17:06</p>
						</div>
				  	</div>
				  	<div class="article-reply">
				    	<p>呵呵呵~</p>
				  	</div>
				  	<div class="fgx"></div>
				  	<div class="article-tab-foot">
				  	 	<div class="article-pinlun"><a href="javascript:void(0)" title=""><span><img src="./../img/icon-pinglun.png" alt=""></span><span> 回复 </span></a></div>
				  	</div>
				 </div>-->
			</div>
	  </div>
	  
	  <!-- 分享弹出层 -->
	  <div class="am-modal-actions" id="my-actions">
		  <div class="am-modal-actions-group">
		    <ul class="am-list">
		      <li class="am-modal-actions-header"><p>分享到</p></li>
		      <li><a href="#"><span class="am-icon-wechat"></span></a></li>
		      <li class="am-modal-actions-danger">
		        <a href="#"><i class="am-icon-twitter"></i> ...</a>
		      </li>
		    </ul>
		  </div>
		  <div class="am-modal-actions-group">
		    <button class="am-btn am-btn-secondary am-btn-block" data-am-modal-close>取消</button>
		  </div>
		</div>
	  <!-- 点赞成功弹出层 -->

	  <!-- 收藏成功弹出层 -->
	
	  	<div data-am-widget="navbar" class="am-navbar am-cf bg-fff" id="mendb">
			<div class="release">
				<input class="huifucon" placeholder="添加你的看法...."/>
				<button type="button" class="fabu font15">发布</button>
			</div>
		</div>
		
		<div class="am-modal am-modal-alert" tabindex="-1" id="malert">
		  	<div class="am-modal-dialog" style="border-radius: 10px;">
		    	<div class="am-modal-bd">不能评论空的内容哦！</div>
		    </div>
		</div>
		
		<div class="am-modal am-modal-loading am-modal-no-btn radius4" tabindex="-1" id="my-modal-loading" data-am-modal="{closeViaDimmer: 0}">
			  <div class="am-modal-dialog" style="border-radius: 4px;">
			    	<div class="am-modal-hd">加载中...</div>
				    <div class="am-modal-bd">
				      <span class="am-icon-spinner am-icon-spin"></span>
				    </div>
			  </div>
		</div>
		<script src="../assets/js/jquery.min.js"></script>
		<script src="../assets/js/amazeui.min.js"></script>
		<script src="../assets/js/jquery.cookie.js"></script>
		<script src="../js/ym.js"></script>
		<script>
			$(function(){
				/*全部回复条数*/
				var typeids = ym.getQueryStringByName('articleId');
				ym.ajax({
					url:'/article/getYmAnswerDetail',
					param:{typeId:ym.getQueryStringByName('articleId')},
					success:function(data){
						if(data.res == 1){
							console.log(data);
							var html = "";
							$('.punlun-count-num').text('('+data.obj.replyCount+')');
							$('.hf').text(data.obj.replyCount);
							$('.dianz').text(data.obj.replyCount);
							html += '<ul class="backwhite replycomment" style="margin-top: 1rem;">';
							for(var i=0;i<data.obj.ymAnswerVOs.length;i++){
								var time = data.obj.ymAnswerVOs[i].createTimeString;
          							time = time.substr(5,0);
          						if(data.obj.ymAnswerVOs[i].parentId == 0 || data.obj.ymAnswerVOs[i].parentId == null){
									html += '<li class="am-padding-top-xs am-padding-bottom-xs am-padding-left-sm am-padding-right-sm">';
		          					html += '<div class="number xxpl font15 colorb6bcce">';
		          					html += '<img src="'+data.obj.ymAnswerVOs[i].headimgurl+'">';
		          					html += '<div class="w80 am-margin-left-sm">';
		          					html += '<h4 class="color4E4E font16">'+data.obj.ymAnswerVOs[i].userName+'</h4>';
		          					html += '<p class="color4E4E am-margin-top-0 font14">'+data.obj.ymAnswerVOs[i].answerDes+'</p>';
		          					html += '<span class="font13">'+data.obj.ymAnswerVOs[i].address+'<i class="am-margin-left-xs">'+time+'</i></span>'
		          					html += '</div>';
		          					html += '<span class="plgr" id="'+data.obj.ymAnswerVOs[i].answerDes+'"><img src="../img/pinglun.png"></span>';
							        html += '</div>';  
							        html += '<p style="display:none">';
							        html += '<span class="usid">'+data.obj.ymAnswerVOs[i].answerUserId+'</span>';
							        html += '<span class="usna">'+data.obj.ymAnswerVOs[i].userName+'</span>';
							        html += '</p>';
							        html += '</li>';
		          				}else{
		          					html += '<li class="am-padding-top-xs am-padding-bottom-xs am-padding-left-sm am-padding-right-sm">';
		          					html += '<div class="number xxpl font15 colorb6bcce">';
		          					html += '<img src="'+data.obj.ymAnswerVOs[i].headimgurl+'">';
		          					html += '<div class="w80 am-margin-left-sm">';
		          					html += '<h4 class="color4E4E font16">'+data.obj.ymAnswerVOs[i].userName+'</h4>';
		          					html += '<p class="color4E4E am-margin-top-0 font14"><span>回复<i class="color69e600 am-margin-left-xs">'+data.obj.ymAnswerVOs[i].parentName+'</i>:</span class="font14">'+data.obj.ymAnswerVOs[i].answerDes+'</p>';
		          					html += '<span class="font13">'+data.obj.ymAnswerVOs[i].address+'<i class="am-margin-left-xs">'+time+'</i></span>'
		          					html += '</div>';
		          					html += '<span class="plgr"><img src="../img/pinglun.png"></span>';
							        html += '</div>';   	
							        html += '<p style="display:none">';
							        html += '<span class="usid">'+data.obj.ymAnswerVOs[i].answerUserId+'</span>';
							        html += '<span class="usna">'+data.obj.ymAnswerVOs[i].userName+'</span>';
							        html += '</p>';
							        html += '</li>';
		          				}
							}
							html += '</ul>';
							$('.pinlun-tab').append(html);
							
						}else{console.log("数据获取失败！")}
					}
				});
				/*点击消息图标事件*/
				var articleId = ym.getQueryStringByName('articleId');
				var urls = window.location.pathname+"?articleId="+articleId;
				var a = 0;
			    $('body').on('click','.plgr',function(){
			    	a = 0;
			    	a++;
			    	var id = $(this).parent().siblings('p').find('.usid').text();
			    	var name = $(this).parent().siblings('p').find('.usna').text();
			    	$('.release').children('input').focus();
			    	$('.release').children('input').attr('placeholder','回复:'+name);
			    	popup();
			    	$('body').on('click','.fabu',function(){
			    		if(a == 1){
			    			var answerDes = $('.huifucon').val();
			    			if(answerDes == ""){
			    				$("#malert").modal('open');
								setTimeout(function(){ $("#malert").modal('close');},800);
			    			}else{
			    				ym.ajax({
					                url: "/article/insertAnser",
					                type:"post",
					                param:{
					                	url:urls,
					                    answerDes:answerDes,
					                    typeId:typeids,
					                    parentId:id,
					                    /*用户id*/
					                    answerUserId:1
					                },
					                success: function (data) {
					                	window.location.href="quanbuhuifu.html"+"?articleId="+articleId;
					                }
					            });
			    			}
				    	}
			    	})
			    })
			    /*个人发表事件*/
			    $('body').on('click','.fabu',function(){
			    	if(a == 0){
			    		var answerDes = $('.huifucon').val();
			    		if(answerDes == ""){
		    				$("#malert").modal('open');
							setTimeout(function(){ $("#malert").modal('close');},800);
		    			}else{
		    				ym.ajax({
					            url: "/article/insertAnser",
					            type:"post",
					            param:{
					            	url:urls,
					                answerDes:answerDes,
					                typeId:typeids
					            },
					            success: function (data) {
					            	window.location.href="quanbuhuifu.html"+"?articleId="+articleId;
					            }
					        });
		    			}
					}
				})
			    /*判断移动端的软键盘是否弹出*/
			   function popup(){
			   		var win = $(window).height();
					$(window).resize(function(){
						var thishei = $(this).height();
						if(win - thishei >50){
							
						}else{
							a = 0;
							$('.release').children('input').blur();
							$('.release').children('input').attr('placeholder','添加你的看法....');
						}
					})
			   	}
			})
		</script>
	</body>
</html>
